<template>
  <div>
   
      <!-- 购物车 -->
      <div class="main-bottom" @click="showpopup=!showpopup">
      
        <div class="main_bottom_1">
          <div class="main_bottom_1_img">
            <img v-show="$store.getters.shopcarlist.length ==0" src="../../assets/images/111.png" alt="">
            <img v-show="$store.getters.shopcarlist.length >0" src="../../assets/images/222.png" alt="">
          </div>
        </div>
        <!-- <div class="main_bottom_2"> <span>&yen;{{totalprice}}</span><p>送费0元</p></div> -->
        <div class="main_bottom_2"> 
          <span v-show="$store.getters.shopcarlist.length ==0">&yen;{{totalprice}}</span>
          <span v-show="$store.getters.shopcarlist.length >0" class="plhg">&yen;{{totalprice}}</span>
          
   
            <p v-show="$store.getters.shopcarlist.length ==0"> 配送费0元 </p>
          <p v-show="$store.getters.shopcarlist.length  >0" class="plhg"> 配送费0元 </p>
          </div>
        <div class="main_bottom_3">
          <p v-show="$store.getters.shopcarlist.length ==0"> 去结算 </p>
          <p v-show="$store.getters.shopcarlist.length  >0" class="plhg"> 去结算 </p>
          </div>
      </div>
      <!-- 购物车蒙层 -->
      <!-- round  圆角 -->
      <van-popup v-model="showpopup"  position="bottom" style=" height:46%" >
        <!-- 购物车出口 -->
          <child></child>
     
      </van-popup>
      
    
  </div>
</template>

<script lang="ts">
import { Component, Vue } from "vue-property-decorator";
import child from "./Shopcar/Child.vue"
@Component({
  //注册自定义组件------购物车点击组件
  components:{
      child,
  }

})
export default class Shopcar extends Vue {
  showpopup :Boolean= false;//购物车弹出层显示


//购物车总价格
//计算属性
get totalprice():any{
  let total:number = 0;
  for(let child of this.$store.getters.shopcarlist){//有数量的商品
      total+=child.price*child.num;//全部累加
  }
  return (total).toFixed(2)
}


}
</script>

<style scoped lang="scss">
@import "../../assets/styles/theme.scss";
  //购物车
  .main-bottom {
    position: fixed;
    width: 100%;
    // border-radius: 30px;
    height: 50px;
    bottom: 0;
    background-color: $primary-color;
    // margin-bottom: 5px;
    z-index: 9999;
    display: flex;
    justify-content: space-between;

.main_bottom_1{
  width: 80px;
    background: #07111b;


    .main_bottom_1_img{
      width: 70px;
      height: 70px;
       position:absolute;
        top: -30px;
        left: 10px;
        border-radius: 50%;
      background-color: rgb(182, 150, 150);
    background: #07111b;

      img{
        width: 50px;
        position:absolute;
        top: 10px;
        left: 10px;
      }
    }
}
.main_bottom_2{
  padding:0 12px;
      background: #07111b;
  flex: 1;
    color: #999;
    span{
          border-right: 1px solid hsla(0,0%,100%,.1);
    box-sizing: border-box;
    display: inline-block;
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    margin-top: 12px;
    padding-right: 12px;
    vertical-align: top;
    }
    p{
          display: inline-block;
    font-size: 10px;
    line-height: 24px;
    margin: 12px 0 0 12px;
    vertical-align: top;
    }
}
.main_bottom_3{
  width: 105px;
     font-size: 12px;
    font-weight: 700;
    height: 48px;
    line-height: 48px;
    text-align: center;
        color: #999;
}

  }
.plhg{
  color: rgb(255, 255, 255);
}
</style>